
function public_upload(swfUrl,phpUrl,buttonUrl,conurl,inputs,btn){
    window.onload = function() { 
                    var settings = {
                            flash_url : swfUrl,                          
                            upload_url: phpUrl,
                            post_params: {"PHPSESSID" : ""},
                            file_size_limit : "1 MB",
                            file_types : "*.*",
                            file_types_description : "All Files",
                            file_upload_limit : 0,  //配置上传个数
                            file_queue_limit : 0,
                            custom_settings : {
                                progressTarget : "fsUploadProgress",
                                cancelButtonId : "btnCancel"
                            },
                            debug: false,                           
                            button_image_url: buttonUrl,
                            button_width: "88",
                            button_height: "38",
                            button_placeholder_id: btn,
                            button_text: '<span class="theFont">浏览</span>',
                            button_text_style: ".theFont {font-size: 16;}",
                            button_text_left_padding: 24,
                            button_text_top_padding: 8,
                            
                            file_queued_handler : fileQueued,
                            file_queue_error_handler : fileQueueError,
                            file_dialog_complete_handler : fileDialogComplete,
                            upload_start_handler : uploadStart,
                            upload_progress_handler : uploadProgress,
                            upload_error_handler : uploadError,
                            upload_success_handler : uploadSuccess,
                            upload_complete_handler : uploadComplete,
                            queue_complete_handler : queueComplete
                    };
                    swfu = new SWFUpload(settings);                  
	     };

            function fileQueued(file) {
                var progress = new FileProgress(file, this.customSettings.progressTarget);
                progress.setStatus("正在等待...");
                progress.toggleCancel(true, this);
            }

            function fileQueueError(file, errorCode, message) {
            }

            function fileDialogComplete(numFilesSelected, numFilesQueued) {
                    if (numFilesSelected > 0) {
                            document.getElementById(this.customSettings.cancelButtonId).disabled = false;
                    }
                    /* I want auto start the upload and I can do that here */
                    this.startUpload();
            }

            function uploadStart(file) {
                    var progress = new FileProgress(file, this.customSettings.progressTarget);
                    progress.setStatus("正在上传...");
                    progress.toggleCancel(true, this);
                    return true;
            }

            function uploadProgress(file, bytesLoaded, bytesTotal) {
                    var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
                    var progress = new FileProgress(file, this.customSettings.progressTarget);
                    progress.setProgress(percent);
                    progress.setStatus("正在上传...");
            }

            function uploadSuccess(file, serverData) {
                    var progress = new FileProgress(file, this.customSettings.progressTarget);
                    progress.setComplete();
                    progress.setStatus("上传成功");
                    progress.toggleCancel(false);
                    $("#show_img").empty().append('<img src="'+conurl+serverData+'"/>')
                    $(inputs).val(serverData)

                    
            }

            function uploadError(file, errorCode, message) {
            }

            function uploadComplete(file) {
                if (this.getStats().files_queued === 0) {
                        document.getElementById(this.customSettings.cancelButtonId).disabled = true;
                }
            }

            // This event comes from the Queue Plugin
            function queueComplete(numFilesUploaded) {
                    var status = document.getElementById("divStatus");
                    status.innerHTML = numFilesUploaded + " 个文件" + (numFilesUploaded === 1 ? "" : "s") + "已上传.";
            }

    }
    
   